# include <stdio.h>
# include <time.h>
void main()
{
FILE *fp;
fp=fopen("file","w+");
int i=0;
int num=0,randnum=0,maxint=0,minint=0;//num为序号，randnum为随机数，c为随机数的倒数
float c=0.0,maxc=0.0,minc=0.0;
srand((int)time(0));
for (i=0;i<100;i++)
	{
		randnum=rand()%100;	
		if(randnum!=0)
		{
		c=1.0/randnum;
		}
		fprintf(fp,"%d %d %f\n",i+1,randnum,c);
		if (maxint<randnum)
			maxint=randnum;
		if (minint>randnum)
			minint=randnum;
		if (maxc<c)
			maxc=c;
		if (minc>c)
			minc=c;
		printf("%d\t%d\t%f\n",i+1,randnum,c);
	}
	printf("max\t%d\t%0.2f\nmin\t%d\t%f\n",maxint,maxc,minint,minc);//向文件末尾输出max和min
	fclose(fp);
}
